Our aim is to analyze the spatial relationship of weight (wt), mileage (mpg), and horse-power (hp) with respect to the x, y, and z-axes, and to depict the number of cylinders (cyl) by assigning colors to the points.It is possible to see that a plan almost exists in this relation.
fig <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~mpg, color = ~as.factor(cyl))
fig